package com.aspose.cells;

class zaw extends zbz {
   private zast a;
   private boolean d = false;
   private Area e;

   zaw(int var1, zast var2) {
      this.a = var2;
      this.c(4106);
      this.b = var1;
      this.b(16);
      this.c = new byte[16];
      this.c[0] = -1;
      this.c[1] = -1;
      this.c[2] = -1;
      this.c[8] = 1;
      this.c[10] = 1;
      this.c[12] = 78;
      this.c[14] = 77;
   }

   Area a() {
      return this.e;
   }

   void a(Area var1) {
      this.e = var1;
      this.g();
   }

   boolean b() {
      return this.d;
   }

   private void g() {
      boolean var1 = this.e.getFormatting() == 1;
      Color var2 = this.e.getForegroundColor();
      Color var3 = this.e.getBackgroundColor();
      double var4 = this.e.getTransparency();
      if (com.aspose.cells.a.c.zh.a(var2) && !com.aspose.cells.a.c.zh.a(var3)) {
         var2 = Color.getWhite();
      }

      if (var4 > 0.0D && var4 < 1.0D) {
         this.d = true;
      }

      int var6;
      if (!var1 && !com.aspose.cells.a.c.zh.a(var2)) {
         var6 = this.a.a(var2);
         if (var6 != -1) {
            this.c[0] = var2.getR();
            this.c[1] = var2.getG();
            this.c[2] = var2.getB();
            this.c[12] = (byte)var6;
            this.c[10] = (byte)(this.c[10] & 254);
            if (var6 < 9) {
               this.d = true;
            }
         } else {
            this.d = true;
            var6 = this.a.a(var2.getR() & 255, var2.getG() & 255, var2.getB() & 255);
            if (var6 != -1) {
               this.c[0] = var2.getR();
               this.c[1] = var2.getG();
               this.c[2] = var2.getB();
               this.c[12] = (byte)var6;
               this.c[10] = (byte)(this.c[10] & 254);
            } else {
               this.c[0] = -1;
               this.c[1] = -1;
               this.c[2] = -1;
               this.c[12] = 78;
            }
         }
      } else {
         this.c[0] = -1;
         this.c[1] = -1;
         this.c[2] = -1;
         this.c[12] = 78;
      }

      if (!var1 && !com.aspose.cells.a.c.zh.a(var3)) {
         var6 = this.a.a(var3);
         if (var6 != -1) {
            this.c[4] = var3.getR();
            this.c[5] = var3.getG();
            this.c[6] = var3.getB();
            this.c[14] = (byte)var6;
            this.c[10] = (byte)(this.c[10] & 254);
         } else {
            this.d = true;
            this.c[4] = 0;
            this.c[5] = 0;
            this.c[6] = 0;
            this.c[14] = 77;
         }
      } else {
         this.c[4] = 0;
         this.c[5] = 0;
         this.c[6] = 0;
         this.c[14] = 77;
      }

      switch(this.e.getFormatting()) {
      case 0:
         this.c[10] = 1;
         break;
      case 1:
         this.c[8] = 0;
         this.c[10] = 0;
         break;
      case 2:
         this.c[8] = (byte)(this.c[8] | 1);
         this.c[10] = 0;
      }

      if (this.e.e() != null && this.e.getFillFormat().getType() == 5) {
         this.c();
      }

      if (this.e.getInvertIfNegative()) {
         this.c[10] = (byte)(this.c[10] | 2);
      }

   }

   void c() {
      if (this.e.e() != null && this.e.getFillFormat().getType() == 5) {
         switch(this.e.getFillFormat().getPattern()) {
         case 2:
         case 3:
            this.c[8] = 18;
            break;
         case 4:
         case 30:
         case 40:
            this.c[8] = 17;
            break;
         case 5:
         case 6:
         case 31:
            this.c[8] = 16;
            break;
         case 7:
            this.c[8] = 2;
            break;
         case 8:
         case 9:
         case 10:
         case 11:
         case 12:
            this.c[8] = 3;
            break;
         case 13:
            this.c[8] = 4;
            break;
         case 14:
         case 26:
         case 32:
         case 33:
         case 34:
         case 39:
         case 41:
         case 48:
            this.c[8] = 13;
            break;
         case 15:
         case 27:
         case 36:
         case 38:
            this.c[8] = 14;
            break;
         case 16:
         case 18:
            this.c[8] = 7;
            break;
         case 17:
         case 19:
            this.c[8] = 8;
            break;
         case 20:
         case 22:
         case 28:
            this.c[8] = 12;
            break;
         case 21:
         case 23:
         case 29:
            this.c[8] = 11;
            break;
         case 24:
            this.c[8] = 6;
            break;
         case 25:
            this.c[8] = 5;
            break;
         case 35:
         case 44:
         case 45:
            this.c[8] = 15;
            break;
         case 37:
         case 43:
         case 46:
         case 47:
         case 49:
            this.c[8] = 9;
            break;
         case 42:
            this.c[8] = 10;
         }
      }

   }
}
